/*
 * Graphics.java  0.4.0 / Oct 24, 2010
 *
 * Copyright (c) 2010 - 2011, cute4j.com and contributors.
 *
 * This software is licensed under the LGPL version 2.1 license.
 * A copy of this license is included in the file LICENSE-LGPL.txt.
 */
package com.cute4j.swing.graphics;

import com.cute4j.core.AbstractDisposable;

/**
 * Abstract Graphics Object.
 *
 * @author Slobodan Vrkacevic
 * @version 0.4.0
 */
public abstract class Graphics extends AbstractDisposable {

// Protected Constructors. -----------------------------------------------------

  /**
   * Constructs new Graphics object.
   */
  protected Graphics() {
    // empty constructor body
  }

// Public Abstract Methods. ----------------------------------------------------

  /**
   * Returns color of the graphics.
   *
   * @return color of the graphics
   */
  public abstract Color getColor();

  /**
   * Sets color for the graphics.
   *
   * @param color the new color
   */
  public abstract void setColor(Color color);

  /**
   * Returns font of the graphics.
   *
   * @return font of the graphics
   */
  public abstract Font getFont();

  /**
   * Sets font for the graphics.
   *
   * @param font the new font
   */
  public abstract void setFont(Font font);

  /**
   * Returns font metrics of the current font.
   *
   * @return font metrics of the current font
   */
  public abstract FontMetrics getFontMetrics();

  /**
   * Returns paint.
   *
   * @return paint
   */
  public abstract Paint getPaint();

  /**
   * Sets paint.
   *
   * @param paint the paint
   */
  public abstract void setPaint(Paint paint);

  /**
   * Returns stroke.
   *
   * @return stroke
   */
  public abstract Stroke getStroke();

  /**
   * Sets stroke.
   *
   * @param stroke the stroke
   */
  public abstract void setStroke(Stroke stroke);

  /**
   * Draws the shape.
   *
   * @param shape the shape
   */
  public abstract void draw(Shape shape);

  /**
   * Draws the line.
   *
   * @param x1 the x coordinate of the first point
   * @param y1 the y coordinate of the first point
   * @param x2 the x coordinate of the second point
   * @param y2 the y coordinate of the second point
   */
  public abstract void drawLine(int x1, int y1, int x2, int y2);

  /**
   * Draws the rectangle.
   *
   * @param x the x coordinate of the rectangle
   * @param y the y coordinate of the rectangle
   * @param width the width of the rectangle
   * @param height the height of the rectangle
   */
  public abstract void drawRect(int x, int y, int width, int height);

  /**
   * Draws the oval.
   *
   * @param x the x coordinate of the oval
   * @param y the y coordinate of the oval
   * @param width the width of the oval
   * @param height the height of the oval
   */
  public abstract void drawOval(int x, int y, int width, int height);

  /**
   * Draw the image.
   *
   * @param image the image
   * @param x the x coordinate of the image
   * @param y the y coordinate of the image
   */
  public abstract void drawImage(Image image, int x, int y);

  /**
   * Draws the string.
   *
   * @param str the string
   * @param x the x coordinate of the string
   * @param y the y coordinate of the string
   */
  public abstract void drawString(String str, int x, int y);

  /**
   * Fills the shape.
   *
   * @param shape the shape
   */
  public abstract void fill(Shape shape);

  /**
   * Fills the rectangle.
   *
   * @param x the x coordinate of the rectangle
   * @param y the y coordinate of the rectangle
   * @param width the width of the rectangle
   * @param height the height of the rectangle
   */
  public abstract void fillRect(int x, int y, int width, int height);

  /**
   * Fills the oval.
   *
   * @param x the x coordinate of the oval
   * @param y the y coordinate of the oval
   * @param width the width of the oval
   * @param height the height of the oval
   */
  public abstract void fillOval(int x, int y, int width, int height);

// Overridden Methods. ---------------------------------------------------------

  /**
   * {@inheritDoc}
   */
  public String toString() {
    String disposed;
    if (isDisposed()) {
      disposed = "[disposed,";
    } else {
      disposed = "[";
    }
    return getClass().getName() + disposed + "font=" + getFont() + ",color=" +
           getColor() + "]";
  }

}
